page.form = {};
page.form.init = function(){
	 //初始化tree
	  TreeCtr.treeInit("#sysResourcesTree");
	  RsPage.nodeClick(0);
}
page.form.event = {
	submit : function(dialog, callback,index) {
		// 校验
	}
}

var TreeCtr = $.extend({},defaultZtreeConFig,{
	setting:{
		view: {
			selectedMulti: false
		},
		async: {
			enable: true,
			url:contextPath+"/treeController/myMenuTree.htm",
			autoParam:["id", "name=n", "level=lv"],
			otherParam:{"otherParam":"zTreeAsyncTest"},
		    dataType:"json"
		},
		callback: {
			onClick: function(e,id,node){
				RsPage.nodeClick(node.id);
			}
		}
	}
});

var RsPage = {
  nodeClick:function(id){
	  var roleId = $("#roleId").val();
	  LoadHtml(contextPath+'/system/role/roleResChildView.htm',{menuId:id,roleId:roleId},function(msg){
		 $("#resourceContent").html(msg);
	  });
  }		
}
/**
 * 
 * @param menuId
 * @param roleId
 */
function menuCheck(menuId,roleId,_this){
	var check = $(_this).is(':checked');
	var params = {menuId:menuId,roleId:roleId,check:check};
	 $.dataPost(contextPath+'/system/role/menu.htm',params,function(result){
		  if(result.success){
			  GirdCtr.reLoad();
		  }else{
			  layer.msg(result.msg); 
		  }
	  });
}

/**
 * 
 * @param buttonId
 * @param roleId
 */
function buttonCheck(buttonId,roleId,_this){
	var check = $(_this).is(':checked');
	var params = {buttonId:buttonId,roleId:roleId,check:check};
	 $.dataPost(contextPath+'/system/role/button.htm',params,function(result){
		  if(result.success){
			  GirdCtr.reLoad();
		  }else{
			  layer.msg(result.msg); 
		  }
	  });
}





